import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';


import MicServer from '../../single-spa/index'
function initFunc () {
  ReactDOM.render(
    <React.StrictMode>
      <App />
    </React.StrictMode>,
    document.getElementById('app4')
  )
}
// 安装微服务
MicServer.getInstance({
  _ReactDOM: ReactDOM,
}).then((mic) => {
  console.log('app4 getInstance then', mic)
  mic.registerApp({
    el: 'app4',
    name: 'app4',
    type: 'react',
    app: {
      init: initFunc
    }
  })
  // 开启 app1
  mic.startApp({
    name: 'app4'
  }).then((res) => {
    // 加载项目，添加蒙版
    console.log('主项目 app4 挂在成功，期望结果是界面显示主项目，成功的Vue实例是：', res)
  })
}).catch((err) => {
  console.log(err)
})

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
